package com.feihao.zhou.controller.interceptor;

import com.feihao.zhou.controller.results.Result;
import com.feihao.zhou.system.exception.BusinessException;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@ControllerAdvice
class ProjectExceptionAdvice {

    @ExceptionHandler(BusinessException.class)
    @ResponseBody
    public Result doBusinessException(BusinessException e){

        return new Result(e.getCode(),e.getMessage());
    }
}
